import service from "@/utils/request";

//添加分辨率
export function addResolution(
    longResolution: string = "",
    wideResolution: string = "",

) {
    return service({
        url: "/xinfa-service/v1/resolution-ratio/",
        method: "post",
        data: {
            longResolution,
            wideResolution,
        },
    });
}

//获取分辨率
export function resolutionList() {
    return service({
        url: "/xinfa-service/v1/resolution-ratio/",
        method: "get",
    });
}
// 新增节目
export function programAddList(
    linkGroup: string | number,
    programName: string,
    programType: string | number,
    wideResolution:string,
    longResolution: string,
    linkGroupParent: string,
) {
    return service({
        url: "/xinfa-service/v1/program",
        method: "post",
        data: {
            linkGroup,
            programName,
            programType,
            wideResolution,
            longResolution,
    linkGroupParent,
        },
    });
}
//获取节目分组
export function getprogram(id: any) {
    return service({
        url: "/xinfa-service/v1/program/" + id,
        method: "get",
    });
}
// 修改节目分组
export function getprogroup(data:any){
    return service({
        url: "/xinfa-service/v1/program-group",
        method: "put",
        data
    });
}
// 批量修改节目分组  
export function getprogroupupdate(data:any){
    return service({
        url: "/xinfa-service/v1/program/update-group",
        method: "post",
        data
    });
}
// 保存画布  /xinfa-service/v1/scene
export function getscene(
    data: {
        sceneTime: any,
        sceneName: any,
        content: any,
        sceneSize: any,
        linkProgram: any,
    thumbnail:any

    },
) {
    return service({
        url: "/xinfa-service/v1/scene/batch-create-scene",
        method: "post",
        data,
    });
}
// 修改画布
export function editScene(
    data: {
        sceneTime: any,
        sceneName: any,
        content: any,
        sceneSize: any,
        linkProgram: any,
    thumbnail:any,
    programId:any
    },
) {
    return service({
        url: "/xinfa-service/v1/scene",
        method: "put",
        data,
    });
}
// 是否有场景
// 单个删除节目表
export function isExistLinkScene(programId:any) {
    return service({
        url: "/xinfa-service/v1/scene/get-isExistLinkScene/?programId="+programId,
        method: "get",
    });
}
// 获取节目列表分页
export function openprogram(data: {
    pageNum: any,
    pageSize: any,
    longResolution: any,
    wideResolution: any,
    startDate: any,
    endDate: any,
    keyword: any,
    linkGroup:any
}) {
    return service({
        url: "/xinfa-service/v1/program/page?pageNum=" + data.pageNum + '&linkGroup='+data.linkGroup +  '&keyword=' + data.keyword + '&longResolution=' + data.longResolution + '&pageSize=' + data.pageSize + '&wideResolution=' + data.wideResolution + '&startDate=' + data.startDate + '&endDate=' + data.endDate,
        method: "get",
    });
}

// 复制节目
export function CopyOpenprogram(programId: any, programName: any) {
    return service({
        url: "/xinfa-service/v1/program/copy-program?programId=" + programId + '&programName=' + programName,
        method: "post",
    });
}

// 单个删除节目表
export function DelectProgram(id: any) {
    return service({
        url: "/xinfa-service/v1/program/" + id,
        method: "delete",
    });
}
//批量删除节目表 /xinfa-service/v1/program/batch-delete-program
export function batchDelectProgram(data: any) {
    return service({
        url: "/xinfa-service/v1/program/batch-delete-program",
        method: "post",
        data
    });
}
// 发布节目
export function programGuides(data: any) {
    return service({
        url: "/xinfa-service/v1/program-guides",
        method: "post",
        data
    });
}
// 获取节目单表分页
export function getguidesprogram(pageSize: any, pageNum: any, mode: any, auditStatus: any, keyword: any) {
    return service({
        url: "/xinfa-service/v1/program-guides/page?pageSize=" + pageSize + '&pageNum=' + pageNum + '&mode=' + mode + '&auditStatus=' + auditStatus + '&keyword=' + keyword,
        method: "get",
    });
}
// 清空所有节目单
export function removeProgramGuides(data: any) {
    return service({
        url: "/xinfa-service/v1/program-guides/remove-program-guides",
        method: "post",
        data
    });
}


// 清空单个节目单DELETE
export function removeSingle(id: any) {
    return service({
        url: "/xinfa-service/v1/program-guides/" + id,
        method: "delete"
    });
}
// 审核节目
export function examinePrexamineogramGuides(data: any) {
    return service({
        url: "/xinfa-service/v1/program-guides/examine-program-guides",
        method: "post",
        data
    });
}
// 节目单详情
export function programEdit(id: any) {
    return service({
        url: "/xinfa-service/v1/program-guides/" + id,
        method: "get",
    });
}
// 首页信息统计
export function statistics() {
    return service({
        url: "/xinfa-service/v1/index/statistics",
        method: "get",
    });
}
// 资源折线图
export function resourcesFoldLine(data:{startData: any, endTime: any}) {
    return service({
        url: "/xinfa-service/v1/index/resources-fold-line?startData=" + data.startData + '&endTime=' + data.endTime,
        method: "get"
    });
}
// 流量折线图
export function flowFoldingLine(startData:string,endTime:string) {
    return service({
        url:'/xinfa-service/v1/index/flow-fold-line',
        method:'get',
        params:{startData,endTime}
    })
}

// 查询最新的十条公告
export function resourcesnotice() {
    return service({
        url: "/xinfa-service/v1/notice/",
        method: "get"
    });
}
// 公告详情
export function Gresourcesnotice(id:any) {
    return service({
        url: "/xinfa-service/v1/notice/" + id,
        method: "get"
    });
}
// 公告分页
export function GresourcesPage(data:{startDate:any,endDate:any,noticeTitle:any,noticeType:any,pageNum:any}) {
    return service({
        url: "/xinfa-service/v1/notice/page?startDate="+data.startDate + '&endDate='+data.endDate+'&noticeTitle='+ data.noticeTitle + '&noticeType=' + data.noticeType+'&pageNum='+data.pageNum,
        method: "get"
    });
}
// 站内信查询五条最新消息
export function mailMessage() {
    return service({
        url: "/xinfa-service/v1/mail-message/",
        method: "get"
    });
}
// 消息已读
export function mailMessageread(data:any) {
    return service({
        url: "/xinfa-service/v1/mail-message/message-read",
        method: "post",
        data
    });
}
// 站内信详情
export function mailMessageEdit(id:any) {
    return service({
        url: "/xinfa-service/v1/mail-message/" +id,
        method: "get"
    });
}
// 站内信分页
export function mailMessagePage(data:{pageNum:any,pageSize:any,messageStatus:any,startDate:any,endDate:any,messageTitle:any}) {
    return service({
        url: "/xinfa-service/v1/mail-message/page?pageNum=" + data.pageNum + '&pageSize=' +data.pageSize + '&messageStatus=' + data.messageStatus + '&startDate='+data.startDate+'&endDate='+data.endDate+ '&messageTitle='+data.messageTitle,
        method: "get"
    });
}
// 删除站内信
export function mailMessageDelect(data:any) {
    return service({
        url: "/xinfa-service/v1/mail-message/batch-message",
        method: "delete",
        data
    });
}
//站内信标记全部为已读
export function AllmailMessage() {
    return service({
        url: "/xinfa-service/v1/mail-message/all-message-read",
        method: "post"
    });
}   
// 获取关联的设备或节目
export function programPage(data:{pageNum:any,pageSize:any,deviceId:any,programId:any,startDate:any,endDate:any,deviceName:any,programName:any}) {
    return service({
        url: "/xinfa-service/v1/program-guides-link-program-device/page?pageNum="+data.pageNum + '&programName=' + data.programName +'&startDate='+data.startDate+'&endDate='+ data.endDate + '&deviceName=' + data.deviceName + '&pageSize=' + data.pageSize + '&deviceId='+ data.deviceId + '&programId='+ data.programId,
        method: "get"
    });
}
// 
export function delectDevice (id:any){
    return service({
        url:"/xinfa-service/v1/program-guides-link-program-device/" + id,
        method:'delete'
    })
}
// 修改节目表
export function Editprogram (data:any){
    return service({
        url:"/xinfa-service/v1/program",
        method:'put',
        data
    })
}